/*

Author : 
	aziza yasser: 15898607 : ICB5
	sayli hidir: 06061308 : IFS 4
*/

#include "Squeeze.h"

std::string Squeeze::Encode(std::string filename)
{
	FILE * pFile;
	long size1, size2;

	pFile = fopen (filename.c_str(),"rb");

	fseek (pFile, 0, SEEK_END);
    size1=ftell (pFile);

	std::cout << size1 << std::endl;
	fclose(pFile);

	filename = rle.Encode(mtf.Encode(filename));

	pFile = fopen (filename.c_str(),"rb");

	fseek (pFile, 0, SEEK_END);
    size2 =ftell (pFile);

	std::cout << size2 << std::endl;

	double size = size2;
	size /= size1;
	std::cout << "kompressions Rate : " << size << std::endl;
	fclose(pFile);

	return filename;
//	return rle.Encode(mtf.Encode(filename));


}

std::string Squeeze::getAsMTF(std::string filename)
{
	return mtf.Encode(filename);
}